package com.ll.beautymall.base;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by Administrator on 2016/10/18.
 */
public abstract class BaseFragment extends Fragment {

    private Context mContext;
    private Unbinder bind;

    @Override
    public void onAttach(Context context) {
        super.onAttach(mContext);
        this.mContext = context;
    }


    public Context getFActivity() {
        return mContext;
    }


    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(getFLayoutId(), container, false);
        bind = ButterKnife.bind(this, view);
        initView(container);
        return view;
    }


    protected abstract void initView(ViewGroup container);

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onPause() {
        super.onPause();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (bind != null) {
            bind.unbind();
        }
    }

    public abstract int getFLayoutId();
}
